package _17_剑指Offer;

import java.math.BigInteger;

public class _14_剑指OfferII剪绳子II {

    // 对于割绳子的，分出跟多的3，就越大，3优于2
    public int cuttingRope(int n) {
        if (n == 2) return 1;
        if (n == 3) return 2;
        long res = 1;
        while (n > 4) {
            res *= 3;
            res %= 1000000007;
            n -= 3;
        }
        return (int) (res * n % 1000000007);
    }

}
